package com.partner.share.work.mybatis.plus.bean;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;

/**
 * @author pengyangyan
 */
@EqualsAndHashCode(callSuper = false)
@MappedSuperclass
@Data
@Accessors(chain = true)
public class IDEntity <I extends Serializable,E extends IDEntity<I,E>> extends Model<E> {
    @Id
    @TableId(type = IdType.UUID)
    protected I id;

    @Column(name = "create_time",insertable = false,updatable = false)
    @TableField(insertStrategy = FieldStrategy.NOT_EMPTY,fill = FieldFill.INSERT)
    private Date createTime;

    @Column(name = "update_time",insertable = false,updatable = false)
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY,fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
}
